/*
 *  CustomAssert.h
 *  Musix001
 *
 *  Created by jiji on 08/03/13.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#include <assert.h>
#include <iostream>
#include <cmath>
using namespace std;

#define Assert( expression ) \
	if ( ! ( expression ) ) { \
		cout << "Assert fail, "<< __FILE__ << ":"<< __LINE__ << ":" << # expression \
			 << " but, " << ( expression ) << "\n"; \
	}

#define AssertTrue( expression ) \
	if ( ! ( expression ) ) { \
		cout << "AssertTrue fail, "<< __FILE__ << ":"<< __LINE__ << ":" << # expression \
			 << " but, " << ( expression ) << "\n"; \
	}

#define AssertFalse( expression ) \
	if ( ( expression ) ) { \
		cout << "AssertFalse fail, "<< __FILE__ << ":"<< __LINE__ << ":" << # expression \
			 << " but, " << ( expression ) << "\n"; \
	}

#define AssertEqual( expression, expression2 ) \
	if ( ( expression ) != ( expression2 ) ) { \
		cout << "AssertEqual fail, " << __FILE__ << ":"<< __LINE__ << ":" << # expression << "==" << # expression2 \
			 << " but, " << ( expression ) << " == " << ( expression2 ) << "\n"; \
	}

#define AssertNotEqual( expression, expression2 ) \
	if ( ( expression ) == ( expression2 ) ) { \
		cout << "AssertEqual fail, "<< __FILE__ << ":"<< __LINE__ << ":" << # expression << "!=" << # expression2 \
			 << " but, " << ( expression ) << " == " << ( expression2 ) << "\n"; \
	}

#define AssertEqualWithError( expression, expression2, error ) \
	if ( std::abs( ( expression ) - ( expression2 ) ) > ( error ) ) { \
		cout << "AssertEqual fail, " << __FILE__ << ":"<< __LINE__ << ":" << # expression << "==" << # expression2 \
			 << " but, " << ( expression ) << " == " << ( expression2 ) << "\n"; \
	}
